<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%String path = request.getContextPath();%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>支付表费用转出记录表 管理</title>
    <jsp:include page="../../import.jsp" flush="true"/>
</head>
<body class="iframeBody">
<form id="capFeeOutLog_form">
    <div class="fieldset1 tabel_col tabel_col_1 clearFix">

        <div class="fieldBox col_100">
            <div class="label">支付表号</div>
            <div class="field">
                <input name="paySchNo" id="paySchNo" type="text" class="ui-textbox" value="${capFeeOutLogVO.paySchNo}"
                       validate="{required:true,maxlength:30}">
                <span class="requiredSymbol">*</span>
            </div>
        </div>
        <div class="fieldBox col_100">
            <div class="label">费用类型</div>
            <div class="field">
                <input name="feeTypCd" id="feeTypCd" data-value="${capFeeOutLogVO.feeTypCd}"
                       validate="{required:true}" placeholder="请选择" ltype="combobox">
                <span class="requiredSymbol">*</span>
            </div>
        </div>
        <div class="fieldBox col_100">
            <div class="label">处理方式</div>
            <div class="field">
                <input name="handleWayCd" id="handleWayCd" data-value="${capFeeOutLogVO.handleWayCd}"
                       validate="{required:true}" placeholder="请选择" ltype="combobox">
                <span class="requiredSymbol">*</span>
            </div>
        </div>
        <div class="fieldBox col_100">
            <div class="label">转出金额</div>
            <div class="field">
                <input name="outAmt" id="outAmt" type="text" class="ui-textbox" value=""
                       validate="{required:true,number:true}">
                <span class="requiredSymbol">*</span>
            </div>
        </div>
        <div class="fieldBox col_100">
            <div class="label">转出时间</div>
            <div class="field">
                <input name="outDt" id="outDt" type="text" class="ui-datepicker" value="${capFeeOutLogVO.outDt}"
                       validate="{required:true}">
                <span class="requiredSymbol">*</span>
            </div>
        </div>
        <div class="fieldBox col_100">
            <div class="label">备注</div>
            <div class="field">
                <textarea name="outRem" id="outRem" type="text" class="ui-textbox" cols="50" rows="3"
                          value="${capFeeOutLogVO.outRem}"
                          validate="{required:false,maxlength:300}">${capFeeOutLogVO.outRem}</textarea>
                <input name="paySchDId" id="paySchDId" type="text" style="display: none;"
                       value="${capFeeOutLogVO.paySchDId}">
                <input name="paySchId" id="paySchId" type="text" style="display: none;"
                       value="${capFeeOutLogVO.paySchId}">
                <input name="bizDataId" id="bizDataId" type="text" style="display: none;"
                       value="${capFeeOutLogVO.bizDataId}">
            </div>
        </div>
    </div>
    <div class="btnsBox">
        <span id="saveCapFeeOutLog_Btn" class="sq-button sq-button-round l-dialog-btn-ok">保存</span>
        <input type="reset" id="resetBtn" class="l-button l-button-reset Hide">
    </div>
</form>
<script>
    $(function () {
        var capFeeOutLogId = "${capFeeOutLogVO.id}";//主键ID
        var outAmt = "${capFeeOutLogVO.outAmt}";
        var handleWayCd = "${capFeeOutLogVO.handleWayCd}";
        $("#outAmt").val(FormatMoney(outAmt / 100));

        $("#handleWayCd").ligerComboBox({
            valueField: 'key',
            textField: 'value',
        });
        $("#feeTypCd").ligerComboBox({
            valueField: 'key',
            textField: 'value',
        });
        $("#capFeeOutLog_form").ligerForm({
            validate: true
        });

        liger.get("handleWayCd").setData(${handleWayCdList});
        liger.get("feeTypCd").setData(${feeTypCdList});
        liger.get("feeTypCd").setDisabled(true);
        liger.get("paySchNo").setDisabled(true);
        /*if (handleWayCd) {
            liger.get("handleWayCd").setDisabled(true);
        }*/
        /*if("${capFeeOutLogVO.feeTypCd}"=="11"){//保险保证金
            liger.get("outAmt").setDisabled(true);
        }*/

        /*保存*/
        $("#saveCapFeeOutLog_Btn").click(function (event) {
            var form = liger.get("capFeeOutLog_form");
            if (!form.valid()) {
                $.ligerDialog.SQalert({content: LogUtils.LOG_CMM_MUST_FIX_ITEM_INFO, SQ_type: "warning"});
                return false; //验证不通过，不执行以下代码
            }
            var data = form.getData();
            var amt = data['outAmt'].replace(',', '');
            if (parseInt(amt * 100) > outAmt || parseInt(amt * 100)==0) {
                $.ligerDialog.SQalert({content: "转出金额无效", SQ_type: "warning"});
                return false;
            }
            data['outAmt'] = amt;
            $.ligerDialog.hide();
            var _url;
            if (capFeeOutLogId == '') {//新增
                _url = '<%=path%>/capital/capFeeOutLog/add.do';
            } else {//修改
                _url = '<%=path%>/capital/capFeeOutLog/modify.do?id=' + capFeeOutLogId;
            }
            var wait_dialog;
            $.ajax({
                type: 'post',
                dataType: 'json',
                data: data,
                url: _url,
                beforeSend: function () {
                    wait_dialog = $.ligerDialog.SQalert({content: LogUtils.LOG_CMM_DATA_LOADING, SQ_type: "waitting"});
                },
                success: function (msg) {
                    wait_dialog.close();
                    if (msg.success == 1) {
                        $.ligerDialog.SQalert({content: msg.info, SQ_type: "success"});
                        //parent.$("#clearBtn").click();
                        parent.$("#searchBtn").click();
                        frameElement.dialog.close();
                    } else {
                        $.ligerDialog.SQalert({content: msg.info, SQ_type: "error"});
                    }
                }
            });
        });
    });
</script>
</body>
</html>
